<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>债权转让-${_front_title}</title>
<meta name="keywords" content="${_front_keywords}" />
<meta name="description" content="${_front_description}" />
<link rel="shortcut icon" href="/static/favicon.ico"/>
<link rel="stylesheet" href="/static/front/fonts/iconfont.css">
<link rel="stylesheet" href="${_front_css}/base_new.css">
<link rel="stylesheet" type="text/css" href="${_front_css}/change_detail.css">
<script src="/static/front/js/jquery-1.11.1.min.js"></script>
<script src="/static/front/js/jquery.countdown.js"></script>
<script src="/static/front/js/js.js"></script>
<style type="text/css">
.loginInfo {
    width: 328px;
    height: 271px;
    border: 1px solid #d0d0d0;
    padding-top: 10px;
    float: left;
    margin-top: 20px;
    margin-left: 60px;
}
.overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:998;width:100%;height:100%;_padding:0 20px 0 0;background:#f6f4f5;display:none;}
.showbox{position:fixed;top:0;left:50%;z-index:9999;opacity:0;filter:alpha(opacity=0);margin-left:-80px;}
*html,*html body{background-image:url(about:blank);background-attachment:fixed;}
*html .showbox,*html .overlay{position:absolute;top:expression(eval(document.documentElement.scrollTop));}
#AjaxLoading{border:1px solid #8CBEDA;color:#37a;font-size:12px;font-weight:bold;}
#AjaxLoading div.loadingWord{width:200px;height:50px;line-height:50px;border:2px solid #D6E7F2;background:#fff;}
#AjaxLoading img{margin:10px 15px;float:left;display:inline;}
.cntDigit{margin-top:11px;}
</style>
</head>
<body>

<!-- 头部 开始 -->
<div class="content">
    <#include "../base/top.ftl" />
	<div class="top_border"></div>
	<div class="commonwidth">
		<div class="content_bg">
		<div class="topBox">
	    	<div class="analyse">
	    		<input type="hidden" id="changeId" value="<#if model.id?exists>${model.id}</#if>">
	        	<div class="title">
	            	<span class="tit fl" style="padding-left: 10px;">
		            	<#if model.title??>
		            		债权转让---${model.title}
		            	</#if>
	            	</span>
	            </div>  
	            <div style=" margin-left:20px;">  
	            <ul class="analyseData">
	            	<li>
	                	<p class="fontShow red">
	                	<#if model.money??>
	                		<#if (model.amount != 0 )>
	                    		${model.amount?string('0.00')}元
	                    	<#else>
	                    	 	0.00元
	                    	</#if>
	                	</#if>
	                	</p>
	                    <p class="name">债权总额</p>
	                </li>
	                <li>
	                	<p class="fontShow">
	                		<#if model.min??>
	                    		<#if (model.min != 0 )>
	                        		${model.min?string('0.00')}元
	                        	<#else>
	                        	 	0.00元
	                        	</#if>
	                    	</#if>
	                	</p>
	                    <p class="name">竞拍底价</p>
	                </li>
	                <li>
	                	<p class="fontShow">
	                		<#if model.period??>
								<#if model.period??>
		                            ${model.period}期
		                        </#if>
		                    </#if>
	                	</p>
	                    <p class="name">转让期数</p>
	                </li>
	            </ul>  
	            <ul class="analyseInfo">
	            	<li>
	            		<span>发布时间：</span>
	            		<#if model.createTime??>
	                        ${(model.createTime?string("yyyy-MM-dd HH:mm:ss"))!}	
	                    </#if>
	            	</li>
	                <li >
	                	<span>转让人：</span>
	                	<#if model.overdue?exists>
	                		${model.username[0..1]}***
	                    </#if>
	               	</li>
	                <li>
	                	<span>到期时间：</span>
	                	<#if model.overdue?exists>
	                        ${(model.overdue?string("yyyy-MM-dd HH:mm:ss"))!}	
	                    </#if>
	                </li>
	                <li>
	                	<span>债权转让状态：</span>
						<#if model.status??>
	                        <#if model.status=="Y">
	                        	已完成
	                        <#elseif model.status=="T">
	                        	转让中
	                        <#elseif model.status=="C">
	                        	复审中
	                        </#if>	
	                    </#if>
	                </li>
	            </ul>       
	            </div> 
	        </div>
	        <div id="protocol" class="protocol">查看<a href="/change?id=<#if model.id??>${model.id}</#if>"  target="_blank">《债权转让协议》</a></div>
	        <#if model.status=="Y">
		       <div class="loginInfo" style="background:#f8f8f8;">
		    		<div style="position: absolute;margin:40px 0 0 -60px;"><img src="${_front_images}/invest/changed.png"></div>
		        	<p style="width:317px;height:76px;line-height:76px; font-size:18px; text-align:center;padding: 33px 1px 0 10px;">成交价格：
		        	<span class="leaveMoney">
							<#if (list?? & list?size > 0)>
								<#list list as model>
	                                	<#if model.amount?exists>
	                                		<#if (model.amount != 0 )>
	                                			￥${model.amount?string('#.00')}
		                                	</#if>
	                                	</#if>								
								</#list>
							</#if>
	        		</span>
		        		</p><p style="width:317px;height:76px;line-height:76px; height:76px; font-size:18px; text-align:center;padding: 0 1px 0 10px;">成交时间：
							<#if (list?? & list?size > 0)>
								<#list list as model>
	                                    <#if model.createTime?exists>
	                            			${(model.createTime?string("yyyy-MM-dd HH:mm:ss"))!}	
	                            		</#if> 								
								</#list>
							</#if>
			        	</p>
		        </div>
		    <#elseif model.status=="C">        
		       <div class="loginInfo" style="background:#f8f8f8;">
		    		<div style="position: absolute;margin:40px 0 0 -60px;"><img src="${_front_images}/invest/check.png"></div>
		        	<p style="width:317px;height:76px;line-height:76px; font-size:18px; text-align:center;padding: 33px 1px 0 10px;">购买价格：
		        	<span class="leaveMoney">
							<#if (list?? & list?size > 0)>
								<#list list as model>
	                                	<#if model.amount?exists>
	                                		<#if (model.amount != 0 )>
	                                			￥${model.amount?string('#.00')}
		                                	</#if>
	                                	</#if>								
								</#list>
							</#if>
	        		</span>
		        		</p><p style="width:317px;height:76px;line-height:76px; height:76px; font-size:18px; text-align:center;padding: 0 1px 0 10px;">购买时间：
							<#if (list?? & list?size > 0)>
								<#list list as model>
	                                    <#if model.createTime?exists>
	                            			${(model.createTime?string("yyyy-MM-dd HH:mm:ss"))!}	
	                            		</#if> 								
								</#list>
							</#if>
			        	</p>
		        </div>	        	
	        <#else>
		        <#if userAccount?exists>
		        		<!-- 登录之后显示-->
						<div class="right">
							<div class="div-one">
								<div class="size-16 pull-left">购买债权</div>
							</div>
							<div class="div-two color-blue">
								债权总额：
								<span>
			        				${model.amount}
			        			</span>元
							</div>
							<form id="investmentFrom" novalidate="novalidate">
								<div class="div-three">
									<div class="pull-left">
										<input type="text" id="amount" name="amount" value="${model.min}" readonly class="money-text" placeholder="请输入投资金额" style="background-color:#a19a99">
										<p class="annotate" style="color: red; line-height: 14px; height: 14px; margin: 5px 0px 0px;"></p>
									</div>
									<div class="pull-right">
										<input type="button" onclick="changeBtn()" value="立即承接" class="money-btn Bid-btn">
									</div>
								</div>
								<div class="div-four" style="border-bottom: 0px solid;margin-bottom:5px;">
									<div class="pull-right">
										
									</div>
								</div>
							</form>
							<div style="border-bottom: 1px solid #e1e1e1;"></div>
							<div class="div-five">
								<div class="pull-left">账户余额 
									<a href="javascript:void(0);" style="color: #f26633;">
										<#if userAccount.balance?exists>
						            		<#if (userAccount.balance != 0 )>
					        					￥${userAccount.balance?string('0.00')}
					        				<#else>
					        					￥0.00
					        				</#if>
					            		</#if>
				            		</a> 
				            	</div>
								<div class="pull-right">
									<a href="/account/recharge" target="_blank" style="color: #0068b7;">立即充值</a>
								</div>
							</div>
						</div>        
		        <#else>
		        	<!-- begin 登录之前显示-->
						<div class="right">
							<div class="div-one">
								<div class="size-16 pull-left">购买债权</div>
							</div>
							<div class="div-two color-blue">
								债权总额：
								<span>
			        				${model.amount}
			        			</span>元
							</div>
							<form id="investmentFrom" novalidate="novalidate">
								<div class="div-three">
										<input type="button" onclick="javascript:window.location.href='/login';" style="width:320px" value="立即登录" class="money-btn Bid-btn">
								</div>
								<div class="div-four" style="border-bottom: 0px solid;margin-bottom:5px;">
								<div class="pull-right">
								</div>
								</div>
							</form>
							<div style="border-bottom: 1px solid #e1e1e1;"></div>
							<div class="div-five">
								<div class="pull-left"><a href="/login" class="color-orange" style="color:#f26633;">温馨提示：</a>您还没有登录，请先登录后才能购买</div>
							</div>
						 </div>
			        <!-- end 登录之前显示-->
		        </#if>
	        </#if>
	    </div>
	    </div>
	    <div class="investmentTab">
		        <div class="clear"></div>
		        <div class="tab_box">
				<div class="commonTable" style="margin-left: -50px">
	                <p class="tit commonMarginTop" id="tab3">转让记录</p>
	            	<table cellpadding="0" cellspacing="0">
	                	<tbody>
	                		<tr>
		                		<td>序号</td>
		                        <td>承接人</td>
		                        <td>转让金额</td>
		                        <td>转让时间</td>
	                		</tr>
	                	</tbody>
	                	<tbody id="resultList">
	                	<#if (list?? & list?size > 0)>
							<#list list as model>
								<tr>
									<td>
	                                    ${model_index+1}
	                                </td>
	                                <td>
	                                	<#if model.username?exists>
		                                    ${model.username[0..1]}*** 
	                                	</#if>
	                                </td>
	                                <td>
	                                	￥
	                                	<#if model.amount?exists>
	                                		<#if (model.amount != 0 )>
	                                			${model.amount?string('#.00')}
		                                	<#else>
		                                	 	${model.amount?string('0.00')}
		                                	</#if>
	                                	</#if>	
	                                </td>
	                                <td>
	                                    <#if model.createTime?exists>
	                            			${(model.createTime?string("yyyy-MM-dd HH:mm:ss"))!}	
	                            		</#if> 
	                                </td>
								</tr>
	                		</#list>
	                	<#else>
	                		<tr>
	                			<td colspan="4">暂无数据</td>
	                		</tr>	
	                	</#if>
	                	</tbody>
	                </table> 
					</div>
		        </div>    
	        </div>
	    </div>
	</div>
  <div id="footer">
        <div class="content">
            <#include "../base/foot.ftl" />        
        </div>
    </div>
    
    <div class="overlay"></div>

	<div id="AjaxLoading" class="showbox">
	    <div class="loadingWord"><img src="/static/front/images/waiting.gif">投标处理中，请稍候...</div>
	</div>
	
	<div style="height:200px;"></div>
</div>

<script type="text/javascript" src="${_front_js}/layer/layer.js" ></script>
<script type="text/javascript">
	function changeBtn(){
    	var changeId = $("#changeId").val();
    	var amount = $("#amount").val();
		var uid = "<#if user?exists && user.id?exists>${user.id}</#if>";
		$.ajax({
			type: "GET",
            url: '/change/save',
            data:{changeId:changeId},
            async: false,
            success: function(result) {
            	if(result.code == -1){
            		change(uid,changeId); 
            	}else{
            		layer.alert(result.msg,function(index){
	            		layer.close(index);
	            		window.location.reload();
            		});
            	}
            }
	    })	
	}
	
	function change(uid,cid){
		//稍等后图片出现
    	$(".overlay").css({'display':'block','opacity':'0.8'});
    	$(".showbox").stop(true).animate({'margin-top':'300px','opacity':'1'},200);
	    $.ajax({
	        type: "post", 
	        dataType: "json", 
	        url: "/fuion/change",
	        data: {
	            "uid":uid,
	            "cid":cid
	        }, 
	        success: function (result) { 
		        setTimeout(function(){
					//稍等后图片消失
					$(".showbox").stop(true).animate({'margin-top':'250px','opacity':'0'},400);
					$(".overlay").css({'display':'none','opacity':'0'});
		        	if(result.code==-1){
	                	layer.alert("操作成功!",function(index){
	                		layer.close(index);
	                		window.location.reload();
	                	});
		        	}else{
		        		layer.alert("操作失败！错误代码:"+result.entity);
		        	}
		        },3000);
	        }
	     });     	
	}
	
	$("#changeLogin").click(function(){
    	localStorage.setItem("loginurl",window.location.href);
    	window.location.href = "/login";
	});
</script>
</body>
</html>
